<?php
global $_POST;
require_once('./roots.php');
require_once('./classes/rbac.php');

require($root_path.'include/inc_environment_global.php');

$rbac=new rbac();


$gui1=$rbac->Buscar_permiso(NULL,$_POST['name'],NULL,$_SESSION['sess_login_username']);
//var_dump($gui1);

$recurso=$_POST['name'];
foreach ($gui1 as $key => $value) {

//echo "rol:".$value["id_role"]."   recurso:".$value["id_resource"]."  permiso:".$value["action"]." <br />\n";
$aux1=$rbac->Revocar_permiso($value["id_role"],$recurso,$value["action"],$_SESSION['sess_login_username']);
}


$result=$rbac->Destruir_recurso($_POST['name'], $_SESSION['sess_login_username']);
header("Location:$root_path/modules/rbac/RecursoListEliminar.php?result=".$result."&lang=".$lang);

?>
